package entity.CRM;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

@Entity
@Inheritance(strategy= InheritanceType.JOINED)
public class SaleInquiry implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private String saleInquiryDate;
    private Double customDiscount;
    private Integer leadTime;
    private Integer validityPeriod;
    private String expiryDate;

    @ManyToOne
    private SaleLead saleLead;
    @OneToMany
    private List<LineItem> lineItems = new ArrayList<LineItem>();
    
    public String getExpiryDate() {
        return expiryDate;
    }

    public void setExpiryDate(String expiryDate) {
        this.expiryDate = expiryDate;
    }
    
    public Integer getLeadTime() { 
        return leadTime;
    }

    public void setLeadTime(Integer leadTime) {
        this.leadTime = leadTime;
    }

    public Integer getValidityPeriod() {
        return validityPeriod;
    }

    public void setValidityPeriod(Integer validityPeriod) {
        this.validityPeriod = validityPeriod;
    }
    
   
    
    
   
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Double getCustomDiscount() {
        return customDiscount;
    }

    public void setCustomDiscount(Double customDiscount) {
        this.customDiscount = customDiscount;
    }
    
    public String getSaleInquiryDate() {
        return saleInquiryDate;
    }

    public void setSaleInquiryDate(String saleInquiryDate) {
        this.saleInquiryDate = saleInquiryDate;
    }

    public SaleLead getSaleLead() {
        return saleLead;
    }

    public void setSaleLead(SaleLead saleLead) {
        this.saleLead = saleLead;
    }

    public List<LineItem> getLineItems() {
        return lineItems;
    }

    public void setLineItems(List<LineItem> lineItems) {
       this.lineItems = lineItems;
    }

    public Double getTotalPrice() {
        Double temp= new Double(0);
        for (LineItem lineItem: this.getLineItems())
        {
            temp+=lineItem.getFinalPrice();
        }
        return temp;        
    }

    
    
}
